package com.cskaoyan.javase.oop1._7bigexercise._1pvz;

/**
 * @description: 植物类
 * @author: wuguidong@cskaoyan.onaliyun.com
 **/

public class Plant {
    //属性: name,hp,damage,price
    String name;
    int hp;
    int damage;
    int price;
    //成员列表中加上僵尸对象
    Zombie pZombie;


    //行为: attack,beAttacked
    public void attack() {
        System.out.println("我正在攻击" + pZombie.name);
    }

    public void beAttacked() {
        System.out.println("我被" + pZombie.name + "攻击了，我受到" + pZombie.damage + "点伤害，我还剩" + (this.hp - pZombie.damage) + "点生命值~");
    }

    //构造器


    public Plant() {
    }

    public Plant(String name, int hp, int damage, int price) {
        this.name = name;
        this.hp = hp;
        this.damage = damage;
        this.price = price;
        //this.pZombie = pZombie;
    }
}
